﻿using System;
using System.Collections.Generic;
using System.Text;
using CadStrategy2013.DxfData;
using MyTool.FileOpt;

namespace CadStrategy2013.CgqStyle
{
    public class GyBdcClass : Cgq2013
    {
        public GyBdcClass(string secname)
            : base(secname)
        {
        }

        public GyBdcClass(string secname, Dictionary<string, string> dic)
            : base(secname, dic)
        {
        }

        public override List<string> ReadTemplateDxf()
        {
            return ReadDxf(Path + "\\template\\高压不对称.dll");
        }

        public override string GetSaveFileName(int index)
        {
            if (ShiJiTuZhiCount == 1)
                return "\\高压不对称.dxf";
            return "\\高压不对称" + (index + 1).ToString() + ".dxf";
        }

        public override DxfDataClass GetDxfData()
        {
            DxfDataClass dxfDataClass = new DxfDataClass();

            IniFile inifile = new IniFile("./\\" + StationName + "\\gybdc.txt");
            inifile.Load();
            int sum0 = inifile.GetInt("高压不对称", "sum", 0);
            for (int i = 0; i < sum0; i++)
            {
                DevClass devClass = new DevClass();
                string strs = inifile.GetString("高压不对称", (i + 1).ToString());
                string[] s = strs.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);
                int n = s.Length;
                devClass.DevName = s[0];
                if (n <= 1)
                {
                    devClass.peiList.Add(" ");
                    devClass.peiList.Add(" ");
                    devClass.peiList.Add(" ");
                    devClass.peiList.Add(" ");
                    devClass.peiList.Add(" ");
                    devClass.peiList.Add(" ");
                    dxfDataClass.devList.Add(devClass);
                }
                else
                {
                    devClass.peiList.Add(s[1]);
                    devClass.peiList.Add(s[2]);
                    devClass.peiList.Add(s[3]);
                    devClass.peiList.Add(s[4]);
                    devClass.peiList.Add(s[5]);
                    devClass.peiList.Add(s[6]);
                    dxfDataClass.devList.Add(devClass);
                }
            }
            if (sum0 != 0)
            {
                ShiJiBanCount = (dxfDataClass.devList.Count - 1) / BanDevCount + 1;
                ShiJiTuZhiCount = (ShiJiBanCount - 1) / BanCount + 1;
            }
            else
            {
                ShiJiBanCount = 0;
                ShiJiTuZhiCount = 0;
            }

            m_dxfDataClass = dxfDataClass;
            return dxfDataClass;
        }
    }
}